﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BMIcalculator
{
    public partial class form1 : Form
    {
        
        public form1()
        {
            InitializeComponent();
        }

        private void form1_Load(object sender, EventArgs e)
        {

        }

        private void tbxWeight_TextChanged(object sender, EventArgs e)
        {
            

        }

        private void tbxHeight_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void Calculate_Click(object sender, EventArgs e)
        {
            string textweight = tbxWeight.Text;
            string textheight = tbxHeight.Text;
            double weight = Convert.ToDouble(tbxWeight.Text);
            double height = Convert.ToDouble(tbxHeight.Text);
            double BmiIndex = weight / (height * height);
            tbxBmiIndex.Text = Convert.ToString(BmiIndex);

            if (BmiIndex >= 27.5)
            {
                tbxResult.Text = "High Risk";
            }
            else if (BmiIndex >= 23.0 && BmiIndex <= 27.4)
            {
                tbxResult.Text = "Moderate Risk";
            }
            else if (BmiIndex >= 18.5 && BmiIndex <= 22.9)
            {
                tbxResult.Text = "Low Risk";
            }
            else if (BmiIndex < 18.5)
            {
                tbxResult.Text = "Nutritional deficient";
            }
          
        }

        private void tbxBmiIndex_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
